package com.leyou.upload.config;

import com.aliyun.oss.OSS;
import com.aliyun.oss.OSSClientBuilder;
import org.springframework.boot.context.properties.EnableConfigurationProperties;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;

/**
 * @package com.leyou.upload.config
 * @description: OSS云服务配置类
 * @author: 许超越
 * @date 2019/6/25 20:06
 * @version: V1.0
 */
@Configuration
@EnableConfigurationProperties(OSSProperties.class)
public class OSSConfig {

    @Bean
    public OSS ossClient(OSSProperties prop) {
        return new OSSClientBuilder().build(prop.getEndpoint(), prop.getAccessKeyId(), prop.getAccessKeySecret());
    }
}
